package com.ctvit.breadking.news.baidu.controller;

import com.ctvit.breadking.news.baidu.service.VipTranslateService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("baidu")
public class VipTranslateController {

    private final VipTranslateService vipTranslateService;

    public VipTranslateController(VipTranslateService vipTranslateService) {
        this.vipTranslateService = vipTranslateService;
    }

    @RequestMapping("translate")
    public boolean translate() {
        String text = "France’s minority government is expected to survive a no-confidence vote on Tuesday in a test for new conservative Prime Minister Michel Barnier, forced to rely on the far right’s good will to be able to stay in power. " +
                "It comes as Barnier’s fragile government faces a major challenge to get a budget for next year approved with no majority at parliament. " +
                "Following June-July parliamentary elections, the National Assembly, France’s powerful lower house of parliament, is divided into three major blocs: the New Popular Front, Macron’s centrist allies and the far-right National Rally party. None of them won an outright majority. " +
                "The no-confidence motion was brought by 192 lawmakers of a left-wing coalition, the New Popular Front, composed of the hard-left France Unbowed, Socialists, Greens and Communists. It needs 289 votes to pass.";
        return vipTranslateService.translate(text);
    }

}
